﻿var dir  = "http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/";  
var rcnt = 109;
var regs = new Array(rcnt);
regs[1] = /\s:-?\)(?!\))/gi;
regs[2] = /\s:-?\((?!\()/gi;
regs[3] = /\s;-?\)(?!\))/gi;
regs[4] = /\s:D/ig;
regs[5] = /\s;;\)/gi;
regs[6] = /\s&gt;:d&lt;/ig;
regs[7] = /\s:-\//g;
regs[8] = /\s:x/ig;
regs[9] = /\s:"&gt;/g;
regs[10] = /\s:-?P/ig;
regs[11] = /\s:-?\*/g;
regs[12] = /\s=\(\(/g;
regs[13] = /\s:-?o/gi;
regs[14] = /\sX-?\(/gi;
regs[15] = /\s:-?&gt;/gi;
regs[16] = /\sB-\)/gi;
regs[17] = /\s:-s(?!s)/ig;
regs[18] = /\s#:-s/gi;
regs[19] = /\s&gt;:\)/gi;
regs[20] = /\s:-?\(\(/gi;
regs[21] = /\s:\)\)/gi;
regs[22] = /\s:-?\|/gi;
regs[23] = /\s\/:\)/gi;
regs[24] = /\s=\)\)/gi;
regs[25] = /\sO:-\)/ig;
regs[26] = /\s:-B/ig;
regs[27] = /\s=;/gi;
regs[28] = /\sI-\)/ig;
regs[29] = /\s8-\|/ig;
regs[30] = /\sL-\)/ig;
regs[31] = /\s:-&amp;/gi;
regs[32] = /\s:-\$/gi;
regs[33] = /\s\[-\(/gi;
regs[35] = /\s8-}/gi;
regs[36] = /\s&lt;:-P/gi;
regs[37] = /\s\(:\|/gi;
regs[38] = /\s=P~/ig;
regs[39] = /\s:-\?(?!\?)/gi;
regs[40] = /\s#-o/ig;
regs[41] = /\s=D&gt;/ig;
regs[42] = /\s:-ss/ig;
regs[43] = /\s@-\)/ig;
regs[44] = /\s:\^o/ig;
regs[45] = /\s:-w/ig;
regs[46] = /\s:-&lt;/ig;
regs[47] = /\s&gt;:-?P/ig;
regs[48] = /\s&lt;\):\)/ig;
regs[63] = /\s\[-O&lt;/ig;
regs[64] = /\s$-\)/ig;
regs[65] = /\s:-"/ig;
regs[66] = /\sb-\(/ig;
regs[67] = /\s:\)&gt;-/ig;
regs[68] = /\s\[-X/gi;
regs[69] = /\s\\:[dD]\//ig;
regs[70] = /\s&gt;:\//ig;
regs[71] = /\s;\)\)/ig;
regs[76] = /\s:-@/gi;
regs[77] = /\s\^:-?\)\^/gi;
regs[78] = /\s:-j/ig;
regs[79] = /\s\(\*\)/ig;
regs[100] = /\s:\)\]/ig;
regs[101] = /\s:-c/ig;
regs[102] = /\s~[xX]\(/ig;
regs[103] = /\s:-h/ig;
regs[104] = /\s:-t/ig;
regs[105] = /\s8-&gt;/ig;
regs[106] = /\s:-\?\?/ig;
regs[107] = /\s%-\(/ig;

function extractEmoticons(str) {
	str = " " + str + " ";
	for (i=1; i<rcnt; i++)
		if (regs[i] != null) {
			img = ' <img class="yahoo_emoticon" src="'+dir+i+'.gif" />';
			str = str.replace(regs[i], img);
		}
	return str;
}

function extractEmoticonsInElement(e) {
	e.innerHTML = extractEmoticons(e.innerHTML);
}
